package com.itheima.web;

import com.itheima.dto.CheckgroupDTO;
import com.itheima.pojo.Checkgroup;
import com.itheima.service.CheckgroupService;
import com.itheima.support.PageResult;
import com.itheima.support.QueryPageBean;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/checkgroup")
public class CheckgroupController {
    @DubboReference
    private CheckgroupService checkgroupService;

   /* @PostMapping("/save")
    public boolean save(@RequestBody Checkgroup checkgroup){
       return checkgroupService.save(checkgroup);
    }*/
   @PostMapping("/save")
   public boolean save(@RequestBody CheckgroupDTO checkgroupDTO){
       return checkgroupService.saveGroup(checkgroupDTO);
   }


    @PostMapping("/findByPage")
    public PageResult findByPage(@RequestBody QueryPageBean queryPageBean){
        return checkgroupService.findByPage(queryPageBean);
    }

    @GetMapping("/delete/{id}")
    private Boolean delete(@PathVariable("id") Long id){
       return checkgroupService.removeById(id);
    }

    @GetMapping("/findAll")
    public List<Checkgroup> findAll(){
       return checkgroupService.list();
    }


}

